/*
 * @Author: wangqizhang
 * @Date: 2024-05-02 16:27:59
 * @LastEditors: wangqizhang
 * @LastEditTime: 2024-05-12 14:37:50
 * @FilePath: /suixinji-server/router/group.router.js
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
const Router = require('koa-router');
const router = new Router({ prefix: '/group' });
const {
  getList,
  add,
  update,
  getListByQuery,
} = require('../controller/group.controller');
const { validateToken, validBodyData } = require('../middleWare');
const { groupParams } = require('../model/group.model');

//获取所有分组列表
router.get('/groupList', validateToken, getList);
router.post(
  '/add',
  (ctx, next) => validBodyData(ctx, next, groupParams),
  validateToken,
  add
);
router.post(
  '/update',
  (ctx, next) => validBodyData(ctx, next, groupParams),
  validateToken,
  update
);
router.post('/findList/query', validateToken, getListByQuery);
module.exports = router;
